package com.dreamspacex.ligox.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dreamspacex.ligox.dao.UserMapper;
import com.dreamspacex.ligox.pojo.User;
import com.dreamspacex.ligox.service.IUserService;

@Service("userService")
public class UserServiceImpl implements IUserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User getUserById(int userId) {
        // TODO Auto-generated method stub
        return this.userMapper.selectByPrimaryKey(userId);
    }

    @Override
    public int addUser(User user) {
        // TODO Auto-generated method stub
        return this.userMapper.insertSelective(user);
    }

    @Override
    public List<User> selectAll(int start, int pageSize) {
        // TODO Auto-generated method stub
        Map<String, Integer> pages = new HashMap<String, Integer>();
        pages.put("start", start);
        pages.put("pageSize", pageSize);
        return this.userMapper.selectAll(pages);
    }
}
